

import 'package:flutter/cupertino.dart';

mixin YkRtcManagerDelegate {
  Future<void> init(YkRtcManagerController? controller);

  Future login(dynamic params);

  Future logout(dynamic params);

  Future<void> enterRoom(String roomId, bool isLive, dynamic params);

  Future<void> exitRoom(dynamic params);

  Future<void> dispose();

  Widget createWidget(Function(int viewId) onViewCreated);

  ///打开扬声器
  Future<void> openSpeaker(bool isOpen);

  ///切换角色
  Future<void> switchRole(bool isAnchor);

  ///打开麦克风
  Future<void> openMic(bool isOpen);

  ///开始推流
  Future<void> startStreaming();

  ///停止推流
  Future<void> stopStreaming();

  ///开始本地视频推流
  Future<void> startLocalPreview(bool frontCamera, int? viewId);

  ///开始远端视频拉流
  Future<void> startRemoteView(String userId, int? viewId);

  ///停止远端视频拉流
  Future<void> stopRemoteView(String userId);

  ///停止本地视频推流
  Future<void> stopLocalPreview();

  ///切换摄像头
  Future<int?> changeCamera(bool frontCamera);
}

class YkRtcManagerController {
  Function(String userId, bool isOpen)? onMicState;
  Function(String userId, bool isOpen)? onCameraState;
  Function(String userId, bool isLeave)? onRemoteUserState;
  Function(int remoteQuality)? onNetworkQuality;
  Function(String path)? onLocalRecordComplete;
  Function(dynamic params)? onError;
  Function(dynamic params)? onWarning;
  Function()? onTryToReconnect;
  Function()? onConnectionRecovery;

  YkRtcManagerController({
    this.onMicState,
    this.onCameraState,
    this.onRemoteUserState,
    this.onNetworkQuality,
    this.onLocalRecordComplete,
    this.onError,
    this.onWarning,
    this.onTryToReconnect,
    this.onConnectionRecovery,
  });
}